import http from '@/http/api.js'


export const getData = (data) => {
  return http.request({
    url: 'http://127.0.0.1:3000/user/users',
    method: 'post',
    data
  })
}

// 注册
export const register = (data) => {
  return http.request({
    url: 'http://127.0.0.1:3000/user/register',
    method: 'post',
    data
  })
}

// 登录
export const login = (data) => {
  return http.request({
    url: 'http://127.0.0.1:3000/user/login',
    method: 'post',
    data
  })
}

// 更新用户
export const updateUser = (id, data) => {
  return http.request({
    url: `http://127.0.0.1:3000/user/update/${id}`,
    method: 'post',
    data
  })
}

// 判断用户密码
export const checkPassword = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/user/check`,
    method: 'post',
    data
  })
}

// 获取站点
export const getStation = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/station/get`,
    method: 'post',
    data
  })
}

// 获取车辆
export const getTrain = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/train/app/get`,
    method: 'post',
    data
  })
}

// 增加乘车人
export const addPass = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/passenger/add`,
    method: 'post',
    data
  })
}

// 创建订单
export const addOrder = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/order/add`,
    method: 'post',
    data
  })
}

// 获取乘车人
export const getPass = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/passenger/get`,
    method: 'post',
    data
  })
}

// 获取订单
export const getOrder = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/order/get`,
    method: 'post',
    data
  })
}

// 更新乘车人
export const updatePass = (id, data) => {
  return http.request({
    url: `http://127.0.0.1:3000/passenger/${id}`,
    method: 'post',
    data
  })
}

// 更新订单
export const updateOrder = (id, data) => {
  return http.request({
    url: `http://127.0.0.1:3000/order/${id}`,
    method: 'post',
    data
  })
}
// 更新密码
export const updatePassword = (data) => {
  return http.request({
    url: `http://127.0.0.1:3000/user/updatePwd`,
    method: 'post',
    data
  })
}